<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:composition template="/template/templatecomum.xhtml">
		<ui:define name="informacoes" >

		<h:panelGroup >
			<div id="left" style="border-top-color: rgb(67, 145, 67); border-right-color: rgb(67, 145, 67); border-bottom-color: rgb(67, 145, 67); border-left-color: rgb(67, 145, 67); ">
				<h3 class="ttl" style="color: rgb(67, 145, 67); ">Listagem</h3>
			
		<h:form>
			<c:if test="${not empty usuario.servico.usuarios}">
				<table width="100%">
					<tbody>
						<tr style="background-color: #00FF00;">
							<td>NOME </td>
							<td>EMAIL</td>
							<td>LOGIN</td>
							<td></td>
							<td></td>
						</tr>
						<c:forEach var="u" items="${usuario.servico.usuarios}" varStatus="linha">
							
							<tr style="${ linha.count%2==0 ? 'background-color: #FFFFFF' :'background-color: #BBDDBB'}">
								<td>
									<h:outputText value="#{u.nome}"/> 
								</td>
								<td>
									<h:outputText value="#{u.login}"/>
								</td>
								<td>
									<h:outputText value="#{u.email}"/>
								</td>
								<td>
									<h:commandLink action="#{usuario.editar}" title="Editar">
										<f:param name="id" value="#{u.id}"></f:param>
										<h:graphicImage url="/img/edit_green.png"/>
									</h:commandLink> 
								</td>
								<td>
									<h:commandLink action="#{usuario.remover}" title="Remover" onclick="return confirm('Realmente deseja remover esta tarefa?')">
										<f:param name="idRemover" value="#{u.id}"></f:param>
										<h:graphicImage url="/img/delete_green.png"/>
									</h:commandLink> 
								</td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</c:if>
			<c:if test="${empty usuario.servico.usuarios}">
				<p align="center" style="color: #00AA00;font-weight: bold;">Nenhuma Pessoa Encontrada</p>
			</c:if>			
		</h:form>
			</div>
			
			<div id="right">
			<h:panelGroup rendered="#{usuario.editar}">
			
			<h3 class="ttl" style="color: rgb(67, 145, 67); ">Editar</h3>
			
			<h:form id="formEditar">
			<h:panelGrid columns="2">
				
					<h:outputLabel class="lb" value="Nome:"/>
					<h:inputText value="#{usuario.obj.nome}"/>
					<h:outputLabel class="lb" value="Email:"/>
					<h:inputText value="#{usuario.obj.email}"/>
					<h:outputLabel class="lb" value="Login:"/>
					<h:inputText value="#{usuario.obj.login}"/>
					<h:outputLabel class="lb" value="Senha:"/>
					<h:inputSecret value="#{usuario.obj.senha}"/>
					<h:outputLabel class="lb" value="Confirmar Senha:"/>
					<h:inputSecret value="#{usuario.senhaConfirmacao}"/>
					<h:outputLabel/>
					
					<h:commandButton value="Alterar" action="#{usuario.atualizar}"/>
				
			</h:panelGrid>
			</h:form>
			
			</h:panelGroup>
			
		</div>
	
			
		</h:panelGroup>
		

		</ui:define>
	</ui:composition>
</html>